const {
    addApply,
    getApply,
    getApplyByShopid,
    updateApplyById,
    deleteApplysById,
    updateApplyStatus
} = require("../dao/applyDao");

module.exports.addApply = async newShops => {
    const result = await addApply(newShops);
    console.log(result,111);
    if (result) {
        return result;
    }
    return false;
}

// module.exports.deleteApplyByid = async deleteApply => {
//     const result = await deleteApplyByid(deleteApply);
//     if (result) {
//         return true;
//     }
//     return false;
// }

module.exports.getApply = async applys => {
   const data= await getApply(applys);
   console.log(data,222);
   return data
} 

module.exports.getApplyByShopid = async applys => await getApplyByShopid(applys);

//驳回修改状态为status:3； 同意修改状态为status:2
module.exports.updateApplyById = async msg => {
    const result = await updateApplyById(msg);
    return result
}

module.exports.searchApplys = async name => {
    const result = await searchApplys(name);
    if (result.length > 0) {
        return result;
    }
    return false;
}
module.exports.deleteApplysById = async applysId => {
    const result = await deleteApplysById(applysId);
    console.log(result)
    if (result.ok === 1) {
        return true;
    }
    return false;
}


module.exports.updateApplyStatus = async applysStatus => {
    const result = await updateApplyStatus(applysStatus);
    if (result.ok === 1) {
        return true;
    }
    return false;
}